package com.qsi.app.golf.controller;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import com.qsi.app.golf.model.GolfManager;

public class GolferAdminController implements Controller {
	/** Logger for this class and subclasses */
    protected final Log logger = LogFactory.getLog(getClass());

    private GolfManager manager;

    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        Map myModel = new HashMap();
        myModel.put("golfers", manager.getGolfers());
        return new ModelAndView("list", "model", myModel);
    }

    public void setGolfManager(GolfManager manager) {
        this.manager = manager;
    }

    public GolfManager getGolfManager() {
        return manager;
    }

}
